<?PHP
class sys{
  function includeContent(){
    global $currentpage;
    $currentpage->getContent();
  }

  function includeHeader(){
    global $currentpage;
    echo "<title>".$currentpage->title."</title>
          <meta http-equiv=\"Content-Type\" content=\"text/html; 
          charset=iso-8859-1\" />";
    $rows = $GLOBALS['db']->ReadRows("SELECT name, content
                        FROM {'dbprefix'}meta_global
                        UNION SELECT name, content
		            	FROM {'dbprefix'}meta_local
                        WHERE page = '".$currentpage->id."'");
	if($rows){
	  foreach($rows as $row){
        echo "<meta name=\"".$row->name."\" content=\"".$row->content."\" />";
      }
	}
    echo $currentpage->editor->getHeader();
	EventManager::raiseEvent("header_included",".",null);
  }

  function displayBreadcrump($separator,$class,$idpraefix){
    global $currentpage;
    $i = 1;
    $breadcrump = $currentpage->getBreadcrump();
    while($i <= count($breadcrump)){
      echo "<a href=\"".$breadcrump[$i-1][0].".html\" class=\"".$class."\" 
            id=\"".$idpraefix.$i."\">".$breadcrump[$i-1][1]."</a>";
      if($i < count($breadcrump)){
        echo $separator;
      }
      $i++;
    }
  }
  
  function displayMenu($id, $globalstart,$globalend, $elementstart,$elementend,
                       $class){
    Menu::display($id, $globalstart,$globalend, $elementstart,$elementend,$class);
  }

  function displayGlobalMenu($globalstart,$globalend, $elementstart,$elementend,
                       $class){
	   Menu::display(getSetting("global","global","mainmenu"),
		             $globalstart,
		           	 $globalend,
					 $elementstart,
					 $elementend,
					 $class);
  }
 
  function displayLocalMenu($globalstart,$globalend, $elementstart,$elementend,
                       $class){
    global $currentpage;
    if($currentpage->menu > -1){
      Menu::display($currentpage->menu, $globalstart,$globalend, $elementstart,$elementend,$class);
    }
  }

  function getColor($area,$areaType,$id){
    return "#".getSetting($area,$areaType,"skin".$id);
  }

  function localMenuExists(){
    global $currentpage;
	if($currentpage->menu){
	  return true;
	}
	else{
	  return false;
	}
  }
  
  function getTitle(){
    return getSetting("global","global","title");
  }
   
  function getFullSkinPath(){
    return getSetting("global","global","host")."/".SkinController::getCurrentSkinPath()."/";
  }

  function getMenues(){
    return $GLOBALS['db']->ReadRows("SELECT id, name, (
                                       SELECT COUNT( * ) 
                                       FROM {'dbprefix'}menu
                                       WHERE menuID = {'dbprefix'}menu_names.id
                                     )count
                                     FROM `{'dbprefix'}menu_names`");
  }

  function getFooter(){
    return "Hilfe | ContentLion V 1.0.0";
  }
}
?>